<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/tr/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@taglib uri="/jstl/cout" prefix="c"%>
<%@page import="com.infodms.dms.common.Constant"%>
<head>
<%
String contentPath=request.getContextPath();
%>
<jsp:include page="${contextPath}/common/jsp_head_new.jsp" />
<title>月度任务导入 </title>
<script language="JavaScript">
	function doInit(){
		createMonthOptions();
	}
	//创建月份OPTION
	function createMonthOptions(){
		var curyear=${curYear};
		var year=document.getElementById("year").value;
		var month=${curMonth};
		var obj=document.getElementById("month");
		clrOptions(obj);
		if(year!=curyear){
			month=1;
		}
		for(var i=month;i<13;i++){
			var opt=document.createElement("option");	
			opt.value=i;
			opt.appendChild(document.createTextNode(i));
			obj.appendChild(opt);	
		}
	}
	//清空月份OPTION
	function clrOptions(obj){
		obj.options.length=0;
	}
</script>
</head>

<body>
	<div class="wbox">
	<div class="navigation"><img src="<%=contentPath %>/img/nav.gif" />&nbsp;当前位置>计划管理>月度任务>月度任务导入
	</div>
<form name="fm" method="post"  enctype="multipart/form-data">
  
<table class="table_query">
  <tr class="csstr">
    <td colspan="2"> 1、请选择业务范围：
      <select name="buss_area">
	       <c:forEach items="${areaBusList}" var="areaBusList" >
	       		<option value="${areaBusList.AREA_ID }">${areaBusList.AREA_NAME }</option>
		   </c:forEach>
      </select>
    </td>
  </tr>  
  <tr>
    <td class="table_query_label" colspan="2">2、请选择月度任务年月：
      <select name='year' id="year" onchange="createMonthOptions();">
        <%
            String year=(String)request.getAttribute("curYear");
            if(null==year||"".equals(year)){
            	year="0";
            }
            int y=Integer.parseInt(year);
        %>
        <option value="<%=y %>"><%=y %></option>
        <option value="<%=y+1 %>"><%=y+1 %></option>
      </select>
      <select name='month' id="month">
      </select>
      </td>
  </tr>
  <tr>
    <td class="table_query_label" colspan="2">3、请选择月度任务类型：
			<script type="text/javascript">
			genSelBoxExp("plan_type",<%=Constant.PLAN_TYPE%>,"",false,"short_sel","","false",'');
			</script>			
    </td>
  </tr>  
	<tr> 
		<td class="table_query_label" colspan="2">
			4、点“<font color="#FF0000">浏览</font>”按钮，找到您所要导入的的月度目标文件,请确定文件的格式为“<strong>经销商代码—经销商名称—车系代码—车系名称—任务数量</strong>”：&nbsp;&nbsp;&nbsp;</td>
    </tr>
	<tr>
	    <td class="table_query_input" colspan="2">&nbsp;&nbsp;&nbsp;&nbsp; 
	      <input type="file" name="uploadFile" datatype="0,is_null,2000" id="upfile" value="" />
	    </td>
    </tr>
	<tr> 
		<td class="table_query_label" width="30%">5、选择好文件后, 点“<font color="#FF0000">确定</font>”按钮完成粘贴。</td>
	    <td class="table_query_label" align="left" width="56%">
	       <input type="button" id="upbtn" class="cssbutton"  name="vdcConfirm" value="确定" onclick="upload()" />
	       <input type="button" class="long_btn"  name="downloadBtn" value="导入模板下载" onclick="downloadFile()" />
	    </td>
	</tr>
</table>
</form>
</div>
<script type="text/javascript">

	function upload(){
		if(!submitForm('fm')){
			return false;
		}
		document.getElementById("upbtn").disabled=true;
		$('fm').action = "<%=contentPath %>/sales/planmanage/MonthTarget/MonthTargetImport/monthPlanExcelOperate.do";
    	$("fm").submit();
	}
	
	function downloadFile(){
	    fm.action = "<%=contentPath %>/sales/planmanage/MonthTarget/MonthTargetImport/downloadTemple.do";
	    fm.submit();
	}
	
</script>
</body>
</html>
